extends "../cTDM_2/cTDM_2.gd"
func _info():
	pass

func _connect():
	._connect()

func _extInit():
	._extInit()
	chaName = "火法"
	lv = 3
	attCoe.atk = 33 / 8.5 * 2 / 3
	attCoe.maxHp = 720 / 112.5 / 3
	addCdSkill("hf",11)
	addSkillTxt("火球：普攻12%概率召唤火球攻击当前敌人造成(35+10%物攻）点真伤")
	addSkillTxt("火柱：对当前敌人及周围1格内敌人附加1层<火柱燃烧>[每秒造成（10*lv+110%物强）伤害，持续5秒][cd:11秒]")

var pw1 = 12
var hpline = 100
var flag1 = false

func _castCdSkill(id):
	._castCdSkill(id)
	if id == "hf" && aiCha != null:
		cst("火柱","000000",position)
		var cells = aiCha.cell
		var chas = getCellChas(cells,1)
		for i in chas:
			if i != null: 
				hpline = i.att.maxHp * 0.1
				i.addBuff(BF2.new(1,hpline,self,flag1))

func _onAtkChara(atkinfo):
	._onAtkChara(atkinfo)
	if atkinfo.atkType == Chara.AtkType.NORMAL:
		if !sys.rndPer(pw1):return
		cst("火球","000000",position)
		hurtChara(atkinfo.hitCha,35 + att.atk * 0.1,Chara.HurtType.REAL,Chara.AtkType.EFF)


class BF2:
	extends Buff
	var cha
	var dmg
	var hpline
	var flag 
	func _init(lv,hpline,cha,flag1):
		attInit()
		life = lv * 5
		id = "hzrs"
		self.cha = cha
		self.hpline = hpline
		self.dmg = cha.att.atk * 1.1 + 10 * cha.lv
		self.flag = flag1

	func _upS():
		if cha != null:
			cha.hurtChara(masCha,dmg,Chara.HurtType.MGI,Chara.AtkType.EFF)
		else:
			masCha.hurtChara(masCha,dmg,Chara.HurtType.MGI,Chara.AtkType.EFF)
		if !flag:return
		if masCha.att.hp < hpline:
			masCha.cst("烈火","000000",masCha.position)
			masCha.hurtChara(masCha,masCha.att.maxHp*2,Chara.HurtType.REAL,Chara.AtkType.EFF)
			self.isDel = true